
import pandas as pd

class EnglishDict():
	def __init__(self):
		self.data_dict = None

	def load_data(self, dict_path):
		self.data_dict = pd.read_csv(dict_path,
					usecols=["word", "translation"])

	def query(self, word):
		row = self.data_dict.query(f"word == '{word}'")
		if row is not None and row.shape[0] > 0:
			return row.iloc[0]["translation"]
		return "没有查询到结果"


english_dict = EnglishDict()
